// import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'node:path'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json' assert { type: 'json' }

export default defineConfig({
    plugins: [vue(), crx({manifest})],
    resolve: {
        // alias: {
        //     '@': fileURLToPath(new URL('./src', import.meta.url))//new URL(url,baseUrl)
        // }
        alias: [
            {find:'@',replacement:resolve(__dirname,'src')}
        ]
    },
    build: {
        rollupOptions: {
            input: {
                index: resolve(__dirname, 'index.html'),
                onboarding: resolve(__dirname, 'src/onboarding/onboarding.html'),
            }
            // output: {
            //     chunkFileNames: 'static/js/[name]-[hash].js',
            //     entryFileNames: 'static/js/[name]-[hash].js',
            //     assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
            // }
        }
    }
});
